package com.lrj.datastream.transform.basic;

import com.lrj.datastream.domain.ClickEvent;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

/**
 * @author lrj
 * @date 2022/3/28 15:36
 */
public class TestFilter {
    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
        env.setParallelism(1);
        DataStreamSource<ClickEvent> stream = env.fromElements(
                new ClickEvent("Mary", "./home", 1000L),
                new ClickEvent("Blob", "./cart", 2000L),
                new ClickEvent("Mary", "./product?id=100", 3000L));
        stream.filter(v -> v.getUrl().length() > 6).print();
        env.execute(TestFilter.class.getName());
    }
}
